using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using NetCoreClass;
using System.Net;
using System.Net.Http.Headers;

using GoodDotNet.Core.Model;
using  GoodDotNet.Core.Entity;
using GoodDotNet.Service;
using GoodDotNet.Core.Data;
using GoodDotNet.Core.Model.Params;
using GoodDotNet.WebAdmin.HttpContextUser;


namespace GoodDotNet.WebAdmin.Controllers
{
  
  /**
   *
   * @author 大钊
   * @since 2023/8/13 19:17:50
   */
    [ApiController]
	[Route("api/[controller]")]
	public class TestController : BaseController
	{
      public TestController(IUser user, IHttpContextAccessor accessor, IOptions<List<ConnectionString>> conns, ILogger<BaseController> logger, IOptions<Appsettings> appsettings,IOptions<Audiences>audience) : base(user, accessor, conns, logger, appsettings)
            {
    		    }



		
		/// @author 大钊
		/// @since 2023/9/7 14:53:08
		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		[HttpPost]
		[Route("GetPageTest")]

		public Result GetPageTest([FromBody] TestGetPageTestParModel pars)
		{
		  using (var uniOfWork = new UnitOfWork(_conStr))
		  {
		    TestService service = new TestService(uniOfWork);
		    var obj= service.GetPageTest(pars);
				return Sucess(obj);
		  }
		}
		


		
		/// @author 大钊
		/// @since 2023/9/7 15:00:23
		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		[HttpPost]
		[Route("CountTest")]

		public Result CountTest( [FromBody] TestCountTestParModel pars )
		{
		
		  using (var uniOfWork = new UnitOfWork(_conStr))
		  {
		    TestService service = new TestService(uniOfWork);
		    var res=service.CountTest(pars);
		    return Sucess(res);
		  }
		}
		

}
}
